<template>
	<view>
		<u-sticky bgColor="#6492FF" offsetTop=0 customNavHeight=0>
			<navbox title="团队报表"></navbox>
			<view class="" style="padding: 25rpx 16rpx;background-color: #f6f6f6;">
				<view class="con__box">
					<view class="con__box__sr">
						<input v-model="form.childName" type="text" class="con__box__sr__t" placeholder="输入下级昵称"
							placeholder-style="font-size:26rpx;" />
						<view class="u-flex u-flex-y-center u-flex-between" style="width: 440rpx;">
							<!-- <input @click="show=true" type="text" v-model="form.beginBuildTime" class="con__box__sr__t"
								style="width: 147rpx;" placeholder="开始时间" disabled
								placeholder-style="font-size:26rpx;" /> -->
							<view @click="show=true,datetype=1" class="con__box__sr__t u-flex u-flex-y-center" :class="form.beginBuildTime?'c33':''" style="width: 147rpx;">
								{{form.beginBuildTime?form.beginBuildTime:'开始时间'}}
							</view>
							至
							<view @click="show=true,datetype=2" class="con__box__sr__t u-flex u-flex-y-center" :class="form.endBuildTime?'c33':''" style="width: 147rpx;">
								
								{{form.endBuildTime?form.endBuildTime:'截止时间'}}
							</view>
						</view>
					</view>
					<view class="con__box__btn u-flex-xy-center" @click="getlist">
						查询
					</view>
				</view>
			</view>
		</u-sticky>
		<view class="con" v-if="list.length>0">
			<view class="con__table" v-for="(item,index) in list" :key="index">
				<view class="con__table__tb u-flex fwb">
					<view class="con__table__item" v-if="item.childType==1">
						下级
					</view>
					<view class="con__table__item" v-if="item.childType==2">
						下下级
					</view>
					<view class="con__table__item">
						推广项目
					</view>
					<view class="con__table__item">
						推广数量
					</view>
					<view class="con__table__item">
						总计金额
					</view>
					<view class="con__table__item">
						抽成
					</view>
				</view>
				<view class="con__table__list">
					<view class="con__table__list__name">
						{{item.childName}}
					</view>
					<view class="" style="width: 80%;">
						<view class="con__table__list__list" v-for="(item1,index1) in 5" :key="index1"
							:class="index1+1==5?'bbo':''">
							<view class="con__table__list__list__item">
								快手极速版
							</view>
							<view class="con__table__list__list__item">
								5
							</view>
							<view class="con__table__list__list__item">
								待审核
							</view>
							<view class="con__table__list__list__item">
								20
							</view>
						</view>
					</view>
				</view>

				<view class="con__table__tb u-flex">
					<view class="con__table__item">

					</view>
					<view class="con__table__item">

					</view>
					<view class="con__table__item">
						总计
					</view>
					<view class="con__table__item">
						100
					</view>
					<view class="con__table__item">
						20
					</view>
				</view>
			</view>
		</view>
		<view class="" v-else style="margin-top: 200rpx;">
			<u-empty icon="/static/img/index/empty.png" mode="data" text="暂时没有数据"></u-empty>
		</view>
		<!-- 时间弹框 -->
		<u-datetime-picker :show="show" @confirm="confirm" @cancel="show=false" v-model="value1" mode="date"></u-datetime-picker>

	</view>
</template>

<script>
	import {
		groupreport
	} from '@/api/team.js'
	export default {
		data() {
			return {
				list: [],
				datetype:'',
				form: {
					beginBuildTime: '',
					endBuildTime: '',
					childName: ''
				},
				value1: Number(new Date()),
				show: false,
				show1: false,
			};
		},
		methods: {
			getlist() {
				let form={
					beginBuildTime:this.form.beginBuildTime?this.form.beginBuildTime+' 00:00:00':'',
					endBuildTime:this.form.endBuildTime?this.form.endBuildTime+' 23:59:59':'',
					childName:this.form.childName
				}
				groupreport(form).then(res => {
					if(res.data.code==200){
						this.list=res.data.data
					}
				})
			},
			confirm(e){
				console.log()
				if(this.datetype==1){
					this.form.beginBuildTime=uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
				}
				if(this.datetype==2){
					this.form.endBuildTime=uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
				}
				console.log(this.form.endBuildTime)
				this.show=false
			}
		},
		onLoad() {
			this.getlist()
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f6f6f6;
	}

	.con {
		padding: 0 16rpx 70rpx;

		&__box {
			background: #FFFFFF;
			border-radius: 14rpx;
			padding: 43rpx 33rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			&__sr {
				width: 440rpx;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: space-between;
				height: 133.33rpx;

				&__t {
					width: 390rpx;
					height: 56rpx;
					border-radius: 28rpx;
					border: 1rpx solid rgba(112, 112, 112, .5);
					padding: 0 25rpx;
					font-family: Source Han Sans SC;
					font-weight: 400;
					font-size: 26rpx;
					color: #333;
				}
			}

			&__btn {
				width: 133rpx;
				height: 133rpx;
				background: #6492FF;
				border-radius: 7rpx;
				font-family: Source Han Sans SC;
				font-weight: 400;
				font-size: 26rpx;
				color: #FFFFFF;
			}
		}

		&__table {
			background: #D4E3FF;
			border-radius: 10rpx;
			overflow: hidden;
			border: 1rpx solid #D4E3FF;
			margin-bottom: 25rpx;

			&__tb {
				height: 60rpx;
				background: #D4E3FF;
			}

			&__item {
				width: 20%;
				text-align: center;
				font-family: Source Han Sans SC;
				font-size: 26rpx;
				color: #3E3D3D;
				line-height: 60rpx;
			}

			&__list {
				background-color: #FFFFFF;
				text-align: center;
				font-family: Source Han Sans SC;
				font-size: 26rpx;
				color: #3E3D3D;
				display: flex;
				align-items: center;

				&__name {
					width: 20%;
				}

				&__list {
					// width: 80%;
					display: flex;
					border-left: 1rpx solid #D4E3FF;
					border-bottom: 1rpx solid #D4E3FF;

					&__item {
						width: 25%;
						font-family: Source Han Sans SC;
						font-size: 26rpx;
						color: #3E3D3D;
						line-height: 60rpx;
					}
				}
			}
		}
	}

	.fwb {
		font-weight: bold;
	}

	.bbo {
		border-bottom: 0;
	}
	.c33{
		color: #333;
	}
</style>